package com.sds.sweng.swat.miplatform.ui.design.parts.component;

import org.eclipse.draw2d.IFigure;
import org.eclipse.gef.EditPolicy;

import com.sds.sweng.swat.miplatform.ui.design.figures.ButtonFigureFactory;
import com.sds.sweng.swat.miplatform.ui.design.models.component.MButton;
import com.sds.sweng.swat.miplatform.ui.design.parts.MiplatformComponentPart;
import com.sds.sweng.swat.miplatform.ui.design.policies.DesignComponentEditPolicy;

public class MButtonPart extends MiplatformComponentPart {

	public boolean isSelectable() {
		return true;
	}

	protected IFigure createFigure() {
		MButton model = (MButton) getModel();

		return ButtonFigureFactory.create(model.getType(), model.getText());
	}

	protected void createEditPolicies() {
		installEditPolicy(EditPolicy.COMPONENT_ROLE, new DesignComponentEditPolicy());
	}

}
